<template>
	<view class="">
		<view class="cord">
			<h5 class="bttext">基本信息</h5>
			<view class="textList">
				<view class="textListz">大楼</view>
				<view class="textListy">{{ dataInfo.contract.build_name }}</view>
			</view>
			<view class="textList">
				<view class="textListz">房号</view>
				<view class="textListy">{{dataInfo.contract.room_name}}</view>
			</view>
			<view class="textList">
				<view class="textListz">姓名</view>
				<view class="textListy">{{ dataInfo.contract.user_name }}</view>
			</view>
			<view class="textList">
				<view class="textListz">电话</view>
				<view class="textListy" @click.stop="makePhoneCall(dataInfo.contract.user_phone)">
					{{ dataInfo.contract.user_phone}}
					<u-icon name="phone" size="20" color="#444444"></u-icon>
				</view>
			</view>
			<view class="textList">
				<view class="textListz">收租日</view>
				<view class="textListy">{{ dataInfo.day }}</view>
			</view>
			<view class="textList">
				<view class="textListz">账期</view>
				<view class="textListy">{{ dataInfo.period }}</view>
			</view>
			<view class="textList">
				<view class="textListz">状态</view>
				<view class="textListy">{{formateStatus(dataInfo.status)}}</view>
			</view>
			<!-- <view class="textList">
				<view class="textListz">微信</view>
				<view class="textListy">未关联，点击邀请</view>
			</view>
			<view class="textList">
				<view class="textListz">通知</view>
				<view class="textListy">次</view>
			</view> -->
		</view>

		<view class="cord" v-if="dataInfo.water_electricity.length>0">
			<h5 class="bttext">水电燃气费</h5>
			<view class="textList" v-for="(item,index) in dataInfo.water_electricity" :key="index">
				<view class="textListz">{{item.name}}</view>
				<view class="textListy">{{item.money}}元</view>
			</view>
		</view>
		<view class="cord" v-if=" dataInfo.fixed.length>0">
			<h5 class="bttext">其他费用</h5>
			<view class="textList" v-for="(item,index) in dataInfo.fixed" :key="index">
				<view class="textListz">{{item.type_name}}</view>
				<view class="textListy">{{item.price}}元</view>
			</view>
		</view>
		<view class="cord">
<!--			<h5 class="bttext">合计费用</h5>-->
			<!-- <view class="textList">
				<view class="textListz">收款金额</view>
				<view class="textListy">元</view>
			</view>
			<view class="textList">
				<view class="textListz">收款日期</view>
				<view class="textListy"></view>
			</view>
			<view class="textList">
				<view class="textListz">收款方式</view>
				<view class="textListy"></view>
			</view> -->
			<view class="textList">
				<view class="textListz">备注</view>
				<view class="textListy">{{ dataInfo.remark}}</view>
			</view>
			<!-- 	<view class="textList">
				<view class="textListz">收款记录</view>
				<view class="textListy"
					@click="jump('/pages-landlord/house/historyBills?kw='+dataInfo.contract.room_name)">查看></view>
			</view> -->
			<view class="textList">
				<view class="textListz">关联合同</view>
				<view class="textListy"
					@click="jump('/pages-landlord/room-manage/rental-registration?contract_id='+dataInfo.contract.id)">
					查看
					<u-icon name="arrow-right" size="12" color="#444444"></u-icon>
				</view>
			</view>
		</view>
		<!-- 按钮 -->
		<view class="submitboxbuttons"></view>
	</view>
</template>

<script>
	import {
		billInfoNew
	} from '@/api/landlord.js'
	export default {
		data() {
			return {
				dataInfo: {},
			};
		},
		onLoad(options) {
			if (options.id) {
				this.init(options.id)
			}
		},
		methods: {
			formateStatus(value) {
				if (value == 0) {
					return '待审核'
				} else if (value == 1) {
					return '待收款'
				} else if (value == 2) {
					return '已收款'
				} else {
					return '未知'
				}
			},
			init(e) {
				billInfoNew({
					id: e
				}).then(res => {
					console.log(res.data.data);
					this.dataInfo = res.data.data
				})
			},
			makePhoneCall(phone) {
				uni.makePhoneCall({
					phoneNumber: phone,
				});
			},
			jump(path, parmas) {
				console.log(path);
				uni.navigateTo({
					url: path
				});
			},
		}
	};
</script>

<style lang="scss" scoped>
	.annex {
		margin-top: 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #feede5;
		box-sizing: border-box;
		padding: 15rpx;
		height: 80rpx;
		border-radius: 20rpx;

		.annexbox {
			display: flex;
			justify-content: space-between;
			align-items: center;
		}
	}

	.bttextimg {
		display: flex;
		flex-wrap: wrap;

		.bttextimgbox {
			// border: 1rpx solid red;
			margin: 8rpx;
			width: 150rpx;
			height: 150rpx;
			border-radius: 20rpx;
			overflow: hidden;
		}
	}

	.submitboxbuttons {
		height: 120rpx;
	}

	.submitboxbutton {
		position: fixed;
		bottom: 0rpx;
		left: 0;
		width: 100%;
		height: 120rpx;
		background-color: #fff;
	}

	.submitbox {
		position: fixed;
		bottom: 10rpx;
		left: 50%;
		width: 96%;
		margin: 0 auto;
		border-radius: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		height: 100rpx;
		margin-left: -48%;
		color: #fff;
		background-color: #fe4f04;
	}

	.bttext {
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #2A0C00;
	}

	.textList {
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 80rpx;
		font-size: 25rpx;

		.textListz {
			font-size: 25rpx;
			color: #a4a4a4;
		}

		.textListy {
			display: flex;
			align-items: center;
			gap: 10rpx;
		}
	}

	.cord {
		box-sizing: border-box;
		//width: 95%;
		margin: 30rpx auto;
		box-sizing: border-box;
		padding: 40rpx;
		background: #fff;
		border-radius: 15rpx;
	}

	.box-top {
		width: 100%;
		height: 80rpx;
		background-color: #81b336;
		color: #fff;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>